<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>原型链继承</title>
</head>
<body>
<script>
    function Person(){
        this.name="jon";
        this.age=18;
        this.color="red";
    }
    Person.prototype.sayName=function(){
        alert(this.name);
    };
    function GoodStudent(){
    }
    GoodStudent.prototype=new Person();
    var g1=new GoodStudent();
    var g2=new GoodStudent();
    g1.name="jshd";
    alert(g1.name);
    alert(g2.name);
    alert(GoodStudent.prototype.constructor===Person);
</script>
</body>
</html>